<template>
  <div class="big-screen">
    <div class="header">
      <div class="header-left">
        <div class="title">某公司大数据展示模板标题</div>
        <div class="tabbar">
          <div class="tab-item" v-for="item in tabBarList" :key="item.id">
            {{ item.label }}
          </div>
        </div>
      </div>
      <div class="time">
        {{ time }}
      </div>
    </div>
    <div class="screen-con">
      <div class="con-left">
        <div class="left-top border">
          <div id="chart" style="height: 100%; width: 100%"></div>
        </div>
        <div class="left-bottom border">左下</div>
      </div>
      <div class="con-middle">
        <div class="middle-top border">中上</div>
        <div class="middle-bottom border">中下</div>
      </div>
      <div class="con-right">
        <div class="right-top border">右上</div>
        <div class="right-middle border">右中</div>
        <div class="right-bottom border">右下</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import * as echarts from 'echarts'
import { onMounted, ref } from 'vue'
import dayjs from 'dayjs'

const tabBarList = ref([
  { id: 1, label: '导航标题' },
  { id: 2, label: '导航标题' },
  { id: 3, label: '导航标题' },
  { id: 4, label: '导航标题' }
])
const time = ref(dayjs().format('YYYY-MM-DD HH:mm:ss'))
setInterval(() => {
  time.value = dayjs().format('YYYY-MM-DD HH:mm:ss')
}, 1000)

onMounted(() => {
  var chartDom = document.getElementById('chart')
  var myChart = echarts.init(chartDom)
  var option

  option = {
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        data: [150, 230, 224, 218, 135, 147, 260],
        type: 'line'
      }
    ]
  }

  option && myChart.setOption(option)

  window.addEventListener('resize', function () {
    myChart.resize()
  })
})
</script>

<style scoped lang="scss">
.border {
  border: 1px solid #fff;
}
.big-screen {
  background: url(@/assets/bg.png) no-repeat center;
  background-size: cover;
  padding: 0 10px;
  height: calc(100% - 15px);
  width: calc(100% - 20px);
}
.header {
  height: 10%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  .header-left {
    display: flex;
    align-items: center;
    .title {
      color: #dffcff;
      font-size: 24px;
      font-weight: bold;
    }
    .tabbar {
      display: flex;
      align-items: center;
      margin-left: 30px;
      .tab-item {
        margin-right: 15px;
      }
    }
  }
  .time {
    font-size: 10px;
  }
}
.screen-con {
  display: flex;
  height: calc(90% - 15px);
  width: 100%;
  .con-left {
    width: 20%;
    .left-top {
      height: 40%;
      margin-bottom: 10px;
    }
    .left-bottom {
      height: calc(60% - 10px);
    }
  }
  .con-middle {
    width: calc(60% - 20px);
    margin: 0 10px;
    .middle-top {
      height: calc(70% - 10px);
      margin-bottom: 10px;
    }
    .middle-bottom {
      height: 30%;
    }
  }
  .con-right {
    width: 20%;
    .right-top {
      height: 30%;
    }
    .right-middle {
      height: calc(35% - 10px);
      margin: 10px 0;
    }
    .right-bottom {
      height: calc(35% - 10px);
    }
  }
}
</style>
